#include <stdio.h>

char *my_strcat(char *dest, const char *src)
{
    char *temp = dest;  //定义临时指针temp，让dest始终指向第一个字符串的首地址
    while(*temp != '\0')    //找到dest的末尾
        temp++;
    
    //拼接dest和src
    while(*src != '\0')
    {
        *temp = *src;
        temp++;
        src++;
    }
    *temp = '\0';   //给temp添加结尾\0
    return dest;
}

int main(int argc, char const *argv[])
{
    char arr1[] = "abc";
    char arr2[] = "defg";

    my_strcat(arr1,arr2);
    printf("%s\n",arr1);

    return 0;
}
